<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                xmlns:fn="http://java.sun.com/jsp/jstl/functions"
                template="/templates/ui.xhtml">

    <ui:define name="head">
        <script type="text/javascript">
            document.onkeydown = function TabReplace() {
                if (event.keyCode == 13) {
                    if (event.srcElement.tagName != 'BUTTON')
                        event.keyCode = 9;
                }
            }
        </script>
        <style type="text/css">
            .col-95 {
                width: 95%;
            }

            .col-5 {
                width: 5%;
            }
        </style>
    </ui:define>
    <ui:define name="content">
        <div style="margin:5px">
            <p:tabView id="tabview" dynamic="true" cache="false" style="font-weight:normal;font-style:normal">
                <p:tab title="海尔卡消费明细汇总查询">
                    <h:form>
                        <div id="qrytable">
                            <p:growl id="msgs" showDetail="false"/>
                            <p:panel style="margin-top:10px">
                                <h:panelGrid columns="2" cellspacing="5" columnClasses="col-95,col-5">
                                    <h:panelGrid columns="2" cellspacing="5">
                                        <h:outputLabel value="起始日期:" for="startDate" style="font-weight: bold"/>
                                        <p:inputText id="startDate" required="true" size="27"
                                                     value="#{cdttxnAction.startDate}"
                                                     onclick="WdatePicker({dateFmt:'yyyyMMdd'})"/>

                                        <h:outputLabel value="截止日期:" for="endDate" style="font-weight: bold"/>
                                        <p:inputText id="endDate" required="true" value="#{cdttxnAction.endDate}"
                                                     onclick="WdatePicker({dateFmt:'yyyyMMdd'})" size="27"/>
                                    </h:panelGrid>
                                    <h:panelGrid>
                                        <p:commandButton style="width:100px;" value="查询"
                                                         action="#{cdttxnAction.onStoreQuery}"
                                                         update="pdt,msgs">
                                        </p:commandButton>
                                        <p:commandButton style="width:100px;" value="导出EXCEL"
                                                         action="#{cdttxnAction.onExportExcel}"
                                                         ajax="false"/>
                                    </h:panelGrid>
                                </h:panelGrid>
                            </p:panel>
                            <p:ajaxStatus style="height:18px;text-align:center">
                                <f:facet name="start">
                                    <h:graphicImage value="/images/ajaxloadingbar.gif"/>
                                </f:facet>
                                <f:facet name="complete">
                                    <h:outputText value=""/>
                                </f:facet>
                            </p:ajaxStatus>
                            <p:dataTable id="pdt" dynamic="true" style="width:100%;"
                                         value="#{cdttxnAction.txnList}" var="record"
                                         rowKey="#{record.pkid}"
                                         paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks}
                                         {NextPageLink} {LastPageLink} {RowsPerPageDropdown} 记录笔数：#{fn:length(cdttxnAction.txnList)}  总金额：#{cdttxnAction.txnAmt}"
                                         paginator="true" rows="10" paginatorPosition="bottom"
                                         rowsPerPageTemplate="100,50,30,15,10,5"
                                         emptyMessage="没有查询到数据记录...">
                                <p:column headerText="卡号" style="text-align: center">
                                    <h:outputText value="#{record.actnum}"/>
                                </p:column>
                                <p:column headerText="交易类别" style="text-align: right">
                                    <h:outputText value="#{cdttxnAction.txnType.valueOfAlias(record.txntype).title}"/>
                                </p:column>
                                <p:column headerText="交易金额">
                                    <h:outputText value="#{record.txnamt}" style="float: right">
                                        <f:convertNumber pattern="###,##0.00"/>
                                    </h:outputText>
                                </p:column>
                                <p:column headerText="产品信息" style="text-align: left">
                                    <h:outputText value="#{record.pdctinfo}"/>
                                </p:column>
                                <p:column headerText="客户姓名" style="text-align: left">
                                    <h:outputText value="#{record.cnsumname}"/>
                                </p:column>
                                <p:column headerText="身份证号" style="text-align: left">
                                    <h:outputText value="#{record.idcode}"/>
                                </p:column>
                                <p:column headerText="客户电话" style="text-align: left">
                                    <h:outputText value="#{record.cnsumtel}"/>
                                </p:column>
                                <p:column headerText="交易后余额">
                                    <h:outputText value="#{record.cdtbal}" style="float: right">
                                        <f:convertNumber pattern="###,##0.00"/>
                                    </h:outputText>
                                </p:column>
                                <p:column headerText="交易日期" style="text-align: center">
                                    <h:outputText value="#{record.txndate}"/>
                                </p:column>
                                <p:column headerText="交易地点" style="text-align: right">
                                    <h:outputText value="#{record.txnaddr}"/>
                                </p:column>
                                <p:column headerText="是否清算" style="text-align: right">
                                    <h:outputText
                                            value="#{cdttxnAction.squareFlag.valueOfAlias(record.squareflag).title}"/>
                                </p:column>
                            </p:dataTable>
                        </div>
                    </h:form>
                </p:tab>
            </p:tabView>
        </div>
    </ui:define>
</ui:composition>